package com.arcvideo.acsplayer.mode;

import android.annotation.SuppressLint;
import android.os.Parcel;
import android.os.Parcelable;

public class MediaInfo implements Parcelable {
	public static final int DB_UNSET = -1;
	private int dbId = DB_UNSET;
	private int type;
	private String name;
	private String path;
	private String idkey;
	private String thumbPath;
	private String createDate;
	private long size;
	protected String mimetype;
	protected String profile;

	@SuppressLint("ParcelCreator")
	public MediaInfo(int mediaType) {
		this.type = mediaType;
	}

	public int getDBId() {
		return dbId;
	}

	public void setDBId(int dbId) {
		this.dbId = dbId;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPath() {
		return path;
	}

	public void setPath(String path) {
		this.path = path;
	}

	public String getCreateTime() {
		return createDate;
	}

	public void setCreateTime(String createDate) {
		this.createDate = createDate;
	}

	public long getSize() {
		return size;
	}

	public void setSize(long size) {
		this.size = size;
	}

	public String getMimeType() {
		return mimetype;
	}

	public void setMimetype(String mimetype) {
		this.mimetype = mimetype;
	}

	public String getProfile() {
		return profile;
	}

	public void setProfile(String profile) {
		this.profile = profile;
	}

	public String getThumbPath() {
		return thumbPath;
	}

	public void setThumbPath(String thumbPath) {
		this.thumbPath = thumbPath;
	}

	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel out, int flags) {
		out.writeInt(dbId);
		out.writeInt(type);
		out.writeString(name);
		out.writeString(path);
		out.writeString(idkey);
		out.writeString(thumbPath);
		out.writeString(createDate);
		out.writeLong(size);
		out.writeString(mimetype);
		out.writeString(profile);
	}

	public void readFromParcel(Parcel in) {
		dbId = in.readInt();
		type = in.readInt();
		name = in.readString();
		path = in.readString();
		idkey = in.readString();
		thumbPath = in.readString();
		createDate = in.readString();
		size = in.readLong();
		mimetype = in.readString();
		profile = in.readString();
	}

	public String getIDKey() {
		return idkey;
	}

	public void setIDKey(final String strKey) {
		idkey = strKey;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + dbId;
		result = prime * result + ((path == null) ? 0 : path.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		/*
		 * if (getClass() != obj.getClass()) return false;
		 */
		if (!(obj instanceof MediaInfo))
			return false;
		MediaInfo other = (MediaInfo) obj;
		if (dbId != other.dbId)
			return false;
		if (path == null) {
			if (other.path != null)
				return false;
		} else if (!path.equals(other.path))
			return false;

		return true;
	}

}